<script type="text/javascript">
<!--
	function highlightTextNodes(element, regex, termid) {
		var tempinnerHTML = element.innerHTML;
		// Do regex replace
		// Inject span with class of 'highlighted termX' for google style highlighting
		element.innerHTML = tempinnerHTML.replace(regex,'>$1<span class="highlighted">$2</span>$3<');
	}
	
	function highlightNumbers(element){
		var regexp = new RegExp("([0-9]+[,]*[0-9]+[%]*)","g");
		var tempinnerHTML = element.innerHTML;
		element.innerHTML = tempinnerHTML.replace(regexp,'<span class="number">$1</span>');
	}

	function copyLineContentInElement(id, lineNumber,searchString){
		var element = document.getElementById(id);
		var lineContent = document.getElementById("line_"+(lineNumber)).innerHTML;
		element.innerHTML = lineContent;
	
		var searchTerms = searchString.split(";");
		for (var i in searchTerms)  {
			var searchTerms2 = searchTerms[i].split(" ");
			for (var j in searchTerms2)  {
				// The regex is the secret, it prevents text within tag declarations to be affected
				var regex = new RegExp(">([^<]*)?("+searchTerms2[j]+")([^>]*)?<","ig");
				highlightTextNodes(element, regex, 0);
			}
		}
		highlightNumbers(element);
	}
	-->
</script>
<style type="text/css">
	<!--
	.thematic {
		-moz-border-radius : 10px;
		background-color: #EEE;
		margin: 20px;
		padding-left: 20px;
		padding-bottom: 20px;
		padding-right: 10px;
		padding-top: 5px;
	}
	.line-preview {
		background-color: #edff75;
		width:98%;
		font-size:0.8em;
	}
	span.highlighted {
		background-color: #00FF00;
		font-weight: bold;
	}
	span.number {
		background-color: #00FFFF;
	}
	-->
</style>
